Progress Report by Tong Jun Qun - Week 6
Week 6 12th September to 18th September Upon returning to the project after the weekend, I discovered to my horror that the 2nd setup was no longer working. Specifically, the 2nd and the 6th electromagnets had failed to actuate when the neodymium wand is positioned above them. I set out to troubleshoot the setup by removing the electromagnets and testing them individually. Eventually, I figured out the problem. Some of the connections had gotten loose over the weeke nd. This time round, I made sure to tape the wires firmly together. With the setup in place, I set about to install the new ATMEGA2560-HD1 microcontroller for the 2nd setup. We had tested the 2nd setup initally with the 1st ATMEGA 2560 controller. As always, I ran into some problems. The new ATMEGA2560-HD1 microcontroller I installed could not be powered. I know this because the power source generator indicated there was a short circuit somewhere in the circuit. From that, I deduced that my predecessor must had burned out the chip. As such, I set about to install a new microcontroller board. This turned out t o be more complicated that I thought as I had to solder on new header pins onto the board. It was my first time undertaking such a tedious task as there were about 60 pins I had to solder on. Prior to this, my experience with soldering was limited to simple connections. I also had to short the RS232 TX0 jumper pins together because the lab did not stock jumpers. With the new microcontroller installed, I had hoped that the problem I had earlier in the week with the power supply would be resolved. Unfortunately, the same issue occurred again. Suspecting that the problem had nothing to do with the microcontroller, I set about to find the problem elsewhere. It turns out that I had mistakenly connected the power supply to the wrong polarity (Vcc to Ground, Ground to Vcc). Once that was ratified, the circuit worked. However, I made another mistake. I had set the voltage too high and the microcontroller burned out. Thankfully, I had the previous board that I had mistakenly assumed was damaged. Once the board was connected and I had ascertained that it was powered on, it was time to program the board with the same hex file used for the 1st setup in order to test the system. Unsurprisingly, the setup failed yet again. This time round, only some of the electromagnets could actuate. Worse still, some of the Hall Effect sensors failed to detect the presence of the neodymium wand. It turns out I had made some errors in connecting the wires to the microcontroller board. More specifically, some of the PWM output pins and the ADC input inputs connected to the electromaget and the hall effect sensors respectively were misplaced. However, when I had connected the wires to their proper positions, only five of the six electromagnets worked. All six hall effect sensors worked as well. The sixth electromagnet had failed to actuate. It was clear to me that there was a problem with either the magnet circuit driver board or the microcontroller itself. To troubleshoot this, I replaced the magnet circuit board with three of the spare ones I had, but to no avail. I decided to give it a day and return the next day to work on this. The next day, I consulted Kasun and he suggested that since I had verified that the setup was working, there could be a problem with the hex file I had used. As such, I spent the day reading through the C code line by line to ascertain the problem. Unfortunately, I could not find any problem with the code. That said, I had gained more understanding with the code. As a last ditch attempt, I swapped the output pins for the sixth electromagnet from PB7 to PH5 by programming the microcontroller to output the PWM pulse to the OCR4C register. It worked. I have now successfully replicated the 2nd setup with a new ATMEGA2560 microcontroller. The code changes I have made is as follows case 4:set4c(value); //Change to PH3 (PB4 is spoilt!) break; void set4a(int duty) { OCR4A=duty; // PH3 } The next step would be to remove all the hall effect sensors and leave only one to be used as the input device. The six electromagnets will also be programmed to output different PWM so that the hall effect sensor will be able to discern the different electromagnets from each other and actuate the correct electromagnet and play the corresponding music when positioned over it. During this week’s meeting, we updated Jeffrey and Kasun on the status of the project. Jeffrey decided to ditch the glove idea for the wearables as only the haptic sensor is required. A ring or smaller attachment would be more feasible and cost effective. We have to figure out how to implement the hall effect sensor into the wearable. Jeffrey suggested that we head down to Sim Lim Tower to source for materials and experiment with different form factors for wearables. Yu Shuang suggested that we install a motor to simulate the haptic feedback that we have lost with the replacement of the neodymium magnet. My task for the week is to work on code and try to get the hall effect centric sensing modality working. We were given a week to get all the materials for the wearable ready. The code was a lot more complicated than I had thought. Several problems were immediately apparent during testing. The first of which was the the fact that the combined magnetic field generated by each electromagnet can drastically fluctuate due to the different Pulse Widths I have set to each electromagnets. There is a need to figure out a way to identify the different Pulse Widths emanated by each electromagnet accurately. Simply setting a threshold value for the ADC input from the hall effect sensor will not do as the field always fluctuate. As such, it has a tendency to trigger the music notes at the wrong position. In addition, I have noticed that once the electromagnets changed positions relative to one another, even ever so slightly, I will have to recalibrate the system to take into account the new positions. In addition, I will need to conduct an experiment to determine how the magnetic field changes when all six electromagnets are turned on. It is a huge undertaking and I intend to discuss with the team over the methods we can implement to resolve this issue. Objective Checklist: *To reevaluate the sensing method for the 2nd setup (hall effect sensing) *Conduct experiment to determine how the magnetic field changes when all six electromagnets are turned on. *Pick up Java Language and MAX MSP to be used to implement musical notes for the systems